<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8">
		<title>Document</title>
	</head>
	<body>
		
	</body>
</html>
<script>
	Employee.prototype.a = 5;
	//继承例子
	function Employee(name,gender, age, solary) {
		this.name = name;
		this.gender = gender;
		this.age = age;
		this.solary = solary;

		this.info = function(){
			console.log(this.name, this.gender, this.age, this.solary);
		};

	}
	//构造函数构造出来的对象继承于构造函数的原型属性
	//xiaoming继承于Employee.prototype
	var xiaoming = new Employee("小明", "男", 28,3000);
	xiaoming.info();
	console.log(xiaoming.a)

	var xiaoli = new Employee("小李", "女", 28, 5000);
	console.log(xiaoli.a);

	//主管
	function Manager(name, gender, age, solary, welfare){
		Employee.call(this,name, gender, age, solary);
		this.welfare = welfare;
		this.manage = function(){
			console.log("管理普通员工");
		};
	}
     //m1继承Employee.prototype
     //原型的继承
     Manager.prototype= Employee.prototype;
	var m1 = new Manager("小壮", "男", 29, 8888, 0.03);
	console.log(m1.a); 
	//chrom下提供了一个__proto__属性，指向构造函数的原型
	console.dir(m1);

	//引用类型比较时 == 和 === 作用一样
	console.log(m1.__proto__ == Employee.prototype);

	//对象的构造函数
	console.log(m1.constructor === Employee);

	console.log(m1.constructor.prototype === Employee.prototype);

	//原型链
	//由构造函数的原型组成的一直到null的链娤结构


</script> 